import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI, {
  Message,
  MessageBox
} from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/css/global.css'
import axios from 'axios'

Vue.use(ElementUI)

Vue.config.productionTip = false
// 配置请求根路径
axios.defaults.baseURL = 'http://timemeetyou.com:8889/api/private/v1/'
// 通过axions请求拦截器添加token,保证拥有获取数据的权限
axios.interceptors.request.use(config => {
  config.headers.Authorization = window.sessionStorage.getItem('token')
  // 必须返回config
  return config
})

Vue.prototype.$http = axios

Vue.prototype.$message = Message

Vue.prototype.$confirm = MessageBox.confirm

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')